<template>
	<div class="weihu-detail">
		<app-header :back="true" titleContent="维护详情"></app-header>
		<head-desc v-if="flag" :bgImage="weihuContent.head_pic" :name="weihuContent.name" :address="weihuContent.areas_name" :tel="weihuContent.phone" :timer="weihuContent.created_at"></head-desc>
		<div>
			<p class="text">{{weihuContent.content}}</p>
			<list-images v-if="flag" :listImage = "weihuContent.img" :count="6"></list-images>
		</div>
		<comment @passMethods="_getWeiHuDetail()" v-if="flag" :commentList="commentList" :type="weihuContent.comment_type"></comment>
	</div>
</template>

<script>
import appHeader from '../header/header'
import { getWeiHuDetail } from '../../api/supervisor'
import headDesc from '../common/headDisc'
import listImages from '../common/listImages'
import comment from '../common/comment'
const SUCCESS = 200
export default {
  name: 'weihuDetail',
  data () {
    return {
      weihuContent: {},
      commentList: [],
      flag: false
    }
  },
  components: {
    appHeader,
    headDesc,
    listImages,
    comment
  },
  created () {
    this._getWeiHuDetail()
  },
  methods: {
    _getWeiHuDetail () {
      getWeiHuDetail(this.$route.params.id).then(res => {
        if (res.code === SUCCESS) {
          this.weihuContent = res.data.super
          this.commentList = res.data.comment
          this.flag = true
        }
      })
    }
  }
}
</script>

<style lang='scss' scoped>
.weihu-detail {
  .text {
    padding: 5px 10px;
    line-height: 16px;
  }
}
</style>
